import * as types from './mutation_types'
const mutations = {
  [types.SET_PLAYING](state, flag) {
    state.playing = flag
  },
  [types.SET_CURRENTINDEX](state, i) {
    state.currentIndex = i
  },
  [types.SET_FULLSCREEN](state, flag) {
    state.fullScreen = flag
  },
  [types.SET_PREV](state, list) {
    state.sequenceList = list
  },
  [types.SET_MODE](state, mode) {
    state.mode = mode
  },
  [types.SET_PLAYLIST](state, list) {
    state.playList = list
  },
  // 下一首
  [types.NEXT_ONE](state) {
    state.currentIndex === state.playList.length - 1 ? state.currentIndex = 0 : state.currentIndex++
    state.playing = true
  },
  // 上一首
  [types.PREV_ONE](state) {
    state.currentIndex === 0 ? state.currentIndex = state.playList.length - 1 : state.currentIndex--
    state.playing = true
  }
}
export default mutations
